package acm.usa2007.gnewyork;

import java.util.Scanner;

/*
 * p3005
 * Greater New York 2007
 */

public class p3005 {

	static int N;
	static double fr, to;
	static String unit;

	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);
		N = scanner.nextInt();
		for (int i=1;i<=N;++i) {
			fr = scanner.nextDouble();
			unit = scanner.next();
			if (unit.startsWith("kg")) {
				to = fr * 2.2046;
				System.out.println(i + " " + String.format("%.4f", to) + " lb");
			}
			else if (unit.startsWith("lb")) {
				to = fr * 0.4536;
				System.out.println(i + " " + String.format("%.4f", to) + " kg");
			}
			else if (unit.startsWith("l")) {
				to = fr * 0.2642;
				System.out.println(i + " " + String.format("%.4f", to) + " g");
			}
			else if (unit.startsWith("g")) {
				to = fr * 3.7854;
				System.out.println(i + " " + String.format("%.4f", to) + " l");
			}
		}

	}

}
